//
//  JXTestViewController.m
//  JiaoX
//
//  Created by yinqy on 15/1/28.
//  Copyright (c) 2015年 北京娇羞科技有限公司. All rights reserved.
//

#import "JXTestViewController.h"

@interface JXTestViewController (){
    UIImageView *_iv;
}

@end

@implementation JXTestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:JXGlobalColorBg];
    _iv = [[UIImageView alloc] initWithFrame:CGRectMake(0, 291.0, 60, 60)];
    _iv.image = [UIImage imageNamed:@"ic_launcher"];
//    _iv.alpha = 0;
    [self.view addSubview:_iv];
    
    UIButton *btn = [[UIButton alloc]initWithFrame:CGRectMake(0, 100, 40, 40)];
    [btn setBackgroundColor:[UIColor redColor]];
    [btn addTarget:self action:@selector(startAnim) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
}

-(void)startAnim{
//    CAKeyframeAnimation *bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
//    CGMutablePathRef thePath = CGPathCreateMutable();
//    CGPoint startPoint = CGPointMake(100,300);
//    CGPoint endPoint = CGPointMake(300,400);
//    CGPathMoveToPoint(thePath, NULL, startPoint.x, startPoint.y);
//    //150：x顶点   200：y顶点
//    
//    CGPathAddQuadCurveToPoint(thePath, NULL, 200, 300, endPoint.x, endPoint.y);
//    bounceAnimation.path = thePath;
//    //时间
//    
//    bounceAnimation.duration = 0.5;
//    bounceAnimation.delegate = self;
//    [_iv.layer addAnimation:bounceAnimation forKey:@"move"];
    
//    CAAnimationGroup *group = [CAAnimationGroup animation];
//    group.animations = [NSArray arrayWithObjects:animation31, nil];
    
    CABasicAnimation *pulse = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    pulse.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
    pulse.duration = 0.5 + (rand() % 10) * 0.05;
    pulse.fromValue = [NSNumber numberWithFloat:1];
    pulse.toValue = [NSNumber numberWithFloat:0];
    [_iv.layer addAnimation:pulse forKey:nil];
}


@end
